<?php 
class smail extends IController
{
   public function regis()
   {
     $this->redirect("regis");
   }
   public function zt()
   {

   	 //接id
   	$id=$_GET["id"];
   	//解密
   	$id=base64_decode($id);
   	$arr=array("u_status"=>1);
   		//实例化
   	$model=new Imodel("zc");
   	$model->setData($arr);
   	$res=$model->update("id=$u_id");
   	if($res)
   	{
      $this->redirect("login");
   	}

   }
   public function register()
   {
   	//接值
   	$u_name=IReq::get("u_name");
   	$u_pwd=IReq::get("u_pwd");
   	$u_email=IReq::get("u_email");
   	//实例化
   	$model=new Imodel("zc");
   	//整理成数组
   	$arr=array("u_name"=>$u_name,"u_pwd"=>$u_pwd,"u_status"=>0,"u_email"=>$u_email);
   	$model->setData($arr);
    $res=$model->add();
    // print_r($u_email);die;
    //$res为返回的id;
     if($res)
     {
       $title="欢迎注册我们得网站成为我们得会员";
       $url="http://www.iwebshop.com/index.php/smail/zt/id/".base64_encode($res);//这个id需要接
       $content="请点击此链接加入我们吧".$url;
       $mail=new SendMail();
       $mail->send($u_email,$title,$content);
       // var_dump($mail->getError());
       echo "邮件已发送,请激活";
     }
   }
   // public function login_do()
   // {
   //   //接值
   // 	$u_name=IReq::get("u_name");
   // 	$u_pwd=IReq::get("u_pwd");
   // 	//实例化
   // 	$model=new Imodel("zc");
   // 	$res=$model->query("u_name='$u_name' and u_pwd='$u_pwd'");
   // 	print_r($res);die;
   // 	$u_status=$res[0]["u_status"];
   // 	if($u_status==1)
   // 	{
   //    echo "登录成功";
   // 	}
   // 	else
   // 	{
   // 		 echo "您未激活,请去邮箱激活";
   // 	}
   // }
}
 ?>
